{include="header"}
{include="navigator"}

<div id = "container">
	<h1 class = "header">ข้อมูลพื้นฐาน (Common Data Set)</h1>
	<br>

	{if="$user['level_name']=='officer'"}
		<div class = "tool">
			<a href = "common-form.php"><img src="images/icon/add.png">เพิ่มข้อมูลพื้นฐาน</a>
		</div>

		{loop="group"}
		<table cellpadding = "0" cellspacing = "0" border = "0" class = "list">
			<tr>
				<th class = 'w600'>{$value.name}</th>
				<th class = 'w80'>จำนวน</th>
				<th class = 'w70'>เครื่องมือ</th>
			</tr>
			{loop="$data[$value1.id]"}
				{if="$value2.gid == $value1.id"}
				<tr class = "alt{$key2%2}">
					<td>
						<a href = "common-edit.php?id={$value2.id}">{$key+1}. {$value2.name}</a>
						{if="$value2.upload!=''"}
						<a href = "{$value2.upload}" target = "_blank"><img src="images/filetype_icons/{$value2.icon}" class = "icon"></a>
						{/if}
					</td>
					<td>{$value2.target}</td>
					<td>
						<a href = "common-edit.php?id={$value2.id}" alt = "แก้ไข" title = "แก้ไข"><img src="images/icon/edit.png"></a>
						<a href = "common-delete.php?id={$value2.id}" alt = "ลบ" title = "ลบ" class = "delete"><img src="images/icon/delete.png"></a>
					</td>
				</tr>
				{/if}
			{/loop}
		</table>
		{/loop}

	{else}

		{loop="group"}
		<table cellpadding = "0" cellspacing = "0" border = "0" class = "list">
			<tr>
				<th class = 'w600'>{$value.name}</th>
				<th class = 'w80'>จำนวน</th>
			</tr>
			{loop="$data[$value1.id]"}
				{if="$value2.gid == $value1.id"}
				<tr class = "alt{$key2%2}">
					<td>
						{$key+1}. {$value2.name}
						{if="$value2.upload!=''"}
						<a href = "{$value2.upload}" target = "_blank"><img src="images/filetype_icons/{$value2.icon}" class = "icon"></a>
						{/if}
					</td>
					<td>{$value2.target}</td>
				</tr>
				{/if}
			{/loop}
		</table>
		{/loop}

	{/if}
</div>
{include="footer"}